<!--
 * @Description:
 * @Version: 3.0
 * @Author: Kevin
 * @Date: 2022-07-22 13:10:20
 * @LastEditors: Kevin
 * @LastEditTime: 2022-08-09 10:04:12
-->
<template>
	<div>
		<div class="vs-table-box">
			<el-form v-loading="loading" ref="ruleForm" label-position="right" class="orm-info">
				<!-- <div style="text-align:right;margin-bottom:20px">
                    <el-button type="primary">同意</el-button>
                    <el-button type="primary">驳回</el-button>
                </div> -->
				<el-form-item label="">
					<el-descriptions border>
						<el-descriptions-item label="盘点单号">{{ detail.inventory.number }}</el-descriptions-item>
						<el-descriptions-item label="盘点名称">{{ detail.inventory.title }}</el-descriptions-item>
						<el-descriptions-item label="商品类型">{{ detail.inventory.goods_type | typeFilter }}</el-descriptions-item>
						<el-descriptions-item label="单据备注">{{ detail.inventory.remark }}</el-descriptions-item>
					</el-descriptions>
				</el-form-item>
				<el-form-item>
					<el-table :data="tableData" border style="width: 100%" v-if="detail.inventory.goods_type == 1" :key="0">
						<el-table-column prop="id" label="序号" align="center" width="100"> </el-table-column>
						<el-table-column prop="number" label="商品编码" align="center"> </el-table-column>
						<el-table-column prop="title" label="商品系列" align="center"> </el-table-column>
						<el-table-column prop="roughcast" label="毛坯种类" align="center"> </el-table-column>
						<el-table-column prop="needle" label="递针类型" align="center"> </el-table-column>
						<el-table-column prop="size" label="尺寸" align="center"> </el-table-column>
						<el-table-column prop="sex" label="性别" align="center"> </el-table-column>
						<el-table-column prop="length" label="长度" align="center"> </el-table-column>
						<el-table-column prop="colour" label="颜色" align="center"> </el-table-column>
						<el-table-column prop="stock_count" label="库位库存" align="center"> </el-table-column>
						<el-table-column prop="stock_area_code" label="库位编码" align="center"> </el-table-column>
						<el-table-column prop="inventory_count" label="盘点数量" align="center"> </el-table-column>
						<el-table-column prop="diff_count" label="库存差异" align="center"> </el-table-column>
						<el-table-column prop="remark" label="备注" align="center"> </el-table-column>
					</el-table>
					<el-table :data="tableData" border style="width: 100%" v-else :key="1">
						<el-table-column prop="id" label="序号" align="center" width="100"> </el-table-column>
						<el-table-column prop="number" label="商品编码" align="center"> </el-table-column>
						<el-table-column prop="title" label="商品系列" align="center"> </el-table-column>
						<el-table-column prop="sku_text" label="规格" align="center"> </el-table-column>
						<el-table-column prop="unit" label="单位" align="center"> </el-table-column>
						<el-table-column prop="stock_count" label="库位库存" align="center"> </el-table-column>
						<el-table-column prop="stock_area_code" label="库位编码" align="center"> </el-table-column>
						<el-table-column prop="inventory_count" label="盘点数量" align="center"> </el-table-column>
						<el-table-column prop="diff_count" label="库存差异" align="center"> </el-table-column>
						<el-table-column prop="remark" label="备注" align="center"> </el-table-column>
					</el-table>
				</el-form-item>
				<el-form-item label="">
					<el-descriptions border :column="4">
						<el-descriptions-item label="制单人员">{{ detail.inventory.create_user || '' }}</el-descriptions-item>
						<el-descriptions-item label="制单日期">{{ detail.inventory.create_time ? detail.inventory.create_time.slice(0, 10) : detail.inventory.create_time }}</el-descriptions-item>
					</el-descriptions>
				</el-form-item>
			</el-form>
			<div class="vs-bottom-btns">
				<el-button @click="utils.backPage()">返回</el-button>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				loading: false,
				detail: {
					inventory: {},
				},
				tableData: [],
			};
		},
		created() {
			let { id } = this.$route.query;
			if (id) {
				this.getDetail(id);
			}
		},
		filters: {
			typeFilter(val) {
				let arr = ['', '毛坯', '成品', '洗护产品', '积分商品', '其他'];
				return arr[val];
			},
		},
		methods: {
			async getDetail(id) {
				this.loading = true;
				let { code, data } = await this.$Http.inventoryInfo({ id });
				this.loading = false;
				if (code) {
					this.detail = data;
					this.tableData = data.info;
				}
			},
		},
	};
</script>
<style lang="scss" scoped></style>
